/**
 * @Copyright:Copyright (c) 1992 - 2012
 * @Company: TengTong
 */
package com.tengtong.duang.commons.test;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;

/**
 * 为测试用的基类。
 * 
 * 基类已经内置了 log4j 的输出能力
 *
 * @author jai
 * @since: v1.0
 */
public class BaseTestHasLog4j {

	/**
	 * 只输出到  Console 的 log4j 配置
	 */
	public static void initConsoleLog4j(){
		try{
			PatternLayout pl = new PatternLayout("%d %-5p %c - %m%n");

			ConsoleAppender cp = new ConsoleAppender(pl);

			BasicConfigurator.configure(cp);
			Logger.getRootLogger().addAppender(cp);	
		
			System.out.println("初始化 Log4j 完成。。。。");
		}catch(Exception e){
			System.out.println("[ERROR]==> 初始化 Log4j 输出失败。");
		}
	}
		
}
